package com.minshenglife.zanzan.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.minshenglife.zanzan.dao.TurntableResultDao;
import com.minshenglife.zanzan.entity.TurntableResult;
import com.minshenglife.zanzan.service.TurntableResultService;


/**
 * 转盘结果service
 * @author huodd
 *
 */
@Component
@Transactional
public class TurntableResultServiceImpl implements TurntableResultService{

	@Resource
	TurntableResultDao resultDao;

	@Override
	public void add(TurntableResult result) {
		resultDao.add(result);
	}

	@Override
	@Transactional(readOnly=true)
	public List<TurntableResult> findLuckResultList(String empId,
			Date startDate, Date endDate) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("empId", empId);
		SimpleDateFormat  sdf=new SimpleDateFormat("yyyy-MM-dd");
		map.put("startDate", sdf.format(startDate));
		map.put("endDate", sdf.format(endDate));
		List<TurntableResult> list=resultDao.findBy(map);
		return list;
	}
	
}
